package com.lazybones.base.engineer.controller.google;

import com.lazybones.base.engineer.service.google.IGoogleAuthenticatorService;
import jakarta.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/google")
public class GoogleAuthenticatorController {
    private final Logger log = LoggerFactory.getLogger(GoogleAuthenticatorController.class);
    private final IGoogleAuthenticatorService iGoogleAuthenticatorService;
    public GoogleAuthenticatorController(IGoogleAuthenticatorService iGoogleAuthenticatorService) {
        this.iGoogleAuthenticatorService = iGoogleAuthenticatorService;
    }
    @RequestMapping(value = "/getSecretKey",method = RequestMethod.GET)
    public String getSecretKey(){
        return iGoogleAuthenticatorService.getGoogleSecretKey();
    }
    @RequestMapping(value = "/getGoogleQrCode",method = RequestMethod.GET)
    public void getGoogleQrCode(@RequestParam("codeName") String codeName, HttpServletResponse response){
        iGoogleAuthenticatorService.getGoogleQrcode(codeName,response);
    }
}
